//
//  NewOrderHelper.swift
//  Employee
//
//  Created by swordjoy on 2017/3/28.
//  Copyright © 2017年 remotevillage. All rights reserved.
//

import Foundation

struct NewOrderHelper {
  
  /// 用来判断是否可以完成创建工单
  static func verifyInput(model: NewOrderModel) -> Bool {
  
    if model.title.isEmpty { return false }
    if model.title.sj.length > 20 {
      SJHint.show("标题超过20字")
      return false
    }
    
    if model.categoryId.isEmpty { return false }
    
    if model.priorityLevel.isEmpty { return false }
    
    if model.accept.isEmpty { return false }
    
    if "ORGANIZATION" == model.accept {
      
      if model.acceptOrgId.isEmpty { return false }
      
    }  else if "STAFF" == model.accept {
      
      if model.acceptOrgId.isEmpty { return false }
      if model.acceptStaffId.isEmpty { return false }
      
    }
  
    return true
    
  }
  
}
